UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qv1LFrgDJsxRL0CxBoNg/m5V6cd5LcYJdTXQGhiSOzA=' 
WHERE 
  key_id = '234308ac6a51a48ad3dbe771c8e79d596558c5078b24deca2c16abb727b97554' 
  AND (
    token = 'Qv1LFrgDJsxRL0CxBoNg/m5V6cd5LcYJdTXQGhiSOzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069