UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IYSThzqpogzU36dADa/wwz6n++LgGT6Kkn136Q7evn4=' 
WHERE 
  key_id = '6a46b07a468d04da0c24830d84b434fb5ee61054a80fe75521c53e718c0082ad' 
  AND (
    token = 'IYSThzqpogzU36dADa/wwz6n++LgGT6Kkn136Q7evn4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032