UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3TFJ1IA/hWGS7nBvTVTNNhnXSAZBlLUcbXNHnzSP+k0=' 
WHERE 
  key_id = 'd91496d8f10bc0f1eb1cc8bcc3a35d75678b6b841b2338a6da58980038ecef59' 
  AND (
    token = '3TFJ1IA/hWGS7nBvTVTNNhnXSAZBlLUcbXNHnzSP+k0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032