UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSIHLw+XfKjHjfWstrOFx78jcSTyaCnBORu4oETlrBU=' 
WHERE 
  key_id = 'f0182dadaae629c286064b5b848a127dc2c45ffbdefa3b303e9689f13bc6c676' 
  AND (
    token = 'OSIHLw+XfKjHjfWstrOFx78jcSTyaCnBORu4oETlrBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00168