UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z5+hoEqg9nFlrr6rw0DHx1L/p+X/3R5sYz/qatzAyzQ=' 
WHERE 
  key_id = '8fcd8f5b3d468c7d75783d39b3236c9383a281f03c8474699f5c07510edd8932' 
  AND (
    token = 'z5+hoEqg9nFlrr6rw0DHx1L/p+X/3R5sYz/qatzAyzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042