UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wG3XlFsWl+7PoZ3sD8PgyE0gT6LVJPCmAsOoqkQwBpI=' 
WHERE 
  key_id = '1bbf5b576edef981d6a26c79ae4876b8c266a6944c1536f441bc6974cb9ddf42' 
  AND (
    token = 'wG3XlFsWl+7PoZ3sD8PgyE0gT6LVJPCmAsOoqkQwBpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043