UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vH3miN63Vuhx2UuNlZeSOWk/JOg8iqNU1YyVOE0kn7w=' 
WHERE 
  key_id = 'f17ddebbdbd91f5d6a1d02c3756a61a16d9f357ac8b766e2e3b747724ec04235' 
  AND (
    token = 'vH3miN63Vuhx2UuNlZeSOWk/JOg8iqNU1YyVOE0kn7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048