UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3NcJR1xxOthjT6l3s/JaP4IV16tAzm+4esS3hRAXO4=' 
WHERE 
  key_id = 'c777dc8bf55f056f7c84b1e3024411a9a4af07b84f9a317f8e9ec475ff15cfd3' 
  AND (
    token = 'Y3NcJR1xxOthjT6l3s/JaP4IV16tAzm+4esS3hRAXO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025