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

Query time 0.00041