UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fpJGLWoE0/FHZJjSUV2rz4WHPkW9vl30Q6y6RZ/XeQg=' 
WHERE 
  key_id = '604e7b5b08475e01343932f37f2184029f045baa229e4a6889baed3e6d032471' 
  AND (
    token = 'fpJGLWoE0/FHZJjSUV2rz4WHPkW9vl30Q6y6RZ/XeQg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047