UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3u+AHuBI5hRnba1ZGaCAYIGhmfJHkkD5ouNQCkHNhY=' 
WHERE 
  key_id = '97f8abf23a16e3d3d0bf23d7e5afb17c7f8030b83f8f963458cf430d7518f3ed' 
  AND (
    token = 'B3u+AHuBI5hRnba1ZGaCAYIGhmfJHkkD5ouNQCkHNhY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023