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

Query time 0.00049