UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2zWOYkXxS8xBgWJ5lmQO5UdVqjNNnioe+sy/SY7ZjQ=' 
WHERE 
  key_id = '2e8e3b7004b7620714013a76f87b9221e0099e7fa84f4afd761d7b84f639a207' 
  AND (
    token = 'r2zWOYkXxS8xBgWJ5lmQO5UdVqjNNnioe+sy/SY7ZjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032