UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mY9zkAJ0bsEOHtILtcOunTDJgVZrk5f61e4h79sL8I0=' 
WHERE 
  key_id = '3aad61a105486a92a4bed279b1518828ac81bc659062e838283bc0b86930d128' 
  AND (
    token = 'mY9zkAJ0bsEOHtILtcOunTDJgVZrk5f61e4h79sL8I0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050