UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l3GwM3yI6veEBig1ybxzCUdqNB+wIglelVScBMPpers=' 
WHERE 
  key_id = 'a8c249218d71b8972d0a3682e7ab673f3e419b97b0b7568b8a358191188f20ec' 
  AND (
    token = 'l3GwM3yI6veEBig1ybxzCUdqNB+wIglelVScBMPpers=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050