UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pthOndyzH4pWNIOYA2OLyczuQ4t5g/3cjLJ8HGusamM=' 
WHERE 
  key_id = '6e87a277e9dc5a893ad45b35cbb4377b7d749de47e9a1826ccd606989b9f33b2' 
  AND (
    token = 'pthOndyzH4pWNIOYA2OLyczuQ4t5g/3cjLJ8HGusamM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019