UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qljLaNqWysKoEAGvDTneGY0hApSh2oQZeGMuncQHy8k=' 
WHERE 
  key_id = '8d50aa5dad273c3061b9344ccdbd634affef0c1b1e6b6bd199d2d9eb5d302992' 
  AND (
    token = 'qljLaNqWysKoEAGvDTneGY0hApSh2oQZeGMuncQHy8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036