UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GEttBzyVvXwXFhDLTLVirWNa5ACRP+tZNauodsQUcEQ=' 
WHERE 
  key_id = '145b92b180b4521ce7453c97bcf31db2d5f4784c788f25e24dd07ca7c6daa021' 
  AND (
    token = 'GEttBzyVvXwXFhDLTLVirWNa5ACRP+tZNauodsQUcEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026