UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6qTYco996L0mQlXXEyav9v5V1eHIVa760hqZKNK8c/U=' 
WHERE 
  key_id = 'a440174d218e37a898f6ef6cede42e8c16f12dfa9791a9eafe3e77e2ceab3770' 
  AND (
    token = '6qTYco996L0mQlXXEyav9v5V1eHIVa760hqZKNK8c/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022