UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tbt/iGIEvTb4Fg1zt2DuFAYNpwm0Oe/37EmXlGrckzc=' 
WHERE 
  key_id = '41b9dc2ca66df76999c02569539ed0384d2cb7346e043d83d9b6abeb8bda225a' 
  AND (
    token = 'Tbt/iGIEvTb4Fg1zt2DuFAYNpwm0Oe/37EmXlGrckzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070