UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wYz0H1sQlHY8YK0/Z07mrm9E7O35fcADgHaihij0/L8=' 
WHERE 
  key_id = '23afdb42afac3d6fb8e125ab689239b4f2936a2bd61d2bfe462a98255d936bc3' 
  AND (
    token = 'wYz0H1sQlHY8YK0/Z07mrm9E7O35fcADgHaihij0/L8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020