UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qwCELjUshBHIubBTJREqhvUZrBOvzEoDW7Z2+87OoqY=' 
WHERE 
  key_id = 'f2a362f1bd8ac7c0cc27d34b84da7df1809054a15b5a07a117fa290ab3a04e95' 
  AND (
    token = 'qwCELjUshBHIubBTJREqhvUZrBOvzEoDW7Z2+87OoqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028