UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZlA92PT6wfA5fkxySp/aw0Xqe27ImlYIp2zc6vu79y0=' 
WHERE 
  key_id = 'e793fc215fc73fa6443e682f8ef70baebafd29dc9564976f9757d8410f92c55c' 
  AND (
    token = 'ZlA92PT6wfA5fkxySp/aw0Xqe27ImlYIp2zc6vu79y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016