UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R2k9isLBFjGtOsbj3AT+M4WJcXuzWayj+mcJzdjrpGM=' 
WHERE 
  key_id = 'fa8a37c7357b5d86f4d2f0eae73e4a36aeaeea28d90f84b13925361222057cf9' 
  AND (
    token = 'R2k9isLBFjGtOsbj3AT+M4WJcXuzWayj+mcJzdjrpGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037