UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avUjMxcX407nUsusTsraEQllGZ9PySubTFiso6Tyekc=' 
WHERE 
  key_id = 'd15065777d4d4049268e3ad6622101b98b2d8e02e836661f6ebc1e4998b73e99' 
  AND (
    token = 'avUjMxcX407nUsusTsraEQllGZ9PySubTFiso6Tyekc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00092