UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mcIWfDPTfMJC7kQq/qctSixauh10/tgoSFv77VptAaQ=' 
WHERE 
  key_id = '4ee64e871d3c72955f30e03154a46f5301f3fd3c82309bf036550887a93d9073' 
  AND (
    token = 'mcIWfDPTfMJC7kQq/qctSixauh10/tgoSFv77VptAaQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037