UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gDPQeqKx3rvXopZEp32V0B6Oa/MqDQZjyOTP3393CfA=' 
WHERE 
  key_id = '3ec04ff0b0bdd52645e49c2ceabe14c76a104de2365e40fe5724faf16900894d' 
  AND (
    token = 'gDPQeqKx3rvXopZEp32V0B6Oa/MqDQZjyOTP3393CfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028