UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UFXVlzwTBlXRjfXP3TyiPazxn5nf3Ks6VE1Yo/9emfU=' 
WHERE 
  key_id = '6520af12e329af7bbb218956b37a6817288ae2c3955436e0e3133b9c0dce01d0' 
  AND (
    token = 'UFXVlzwTBlXRjfXP3TyiPazxn5nf3Ks6VE1Yo/9emfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065